package main

import (
	"fmt"
	"sort"
)

func main() {
	// 1、sort升序排序
	intList := []int{3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5}
	float8List := []float64{3.1, 1.2, 4.5, 1.7, 5.3, 9.8, 2.6, 6.2, 5.1, 3.9, 5.4}
	stringList := []string{"apple", "banana", "orange", "pear", "grape", "pineapple", "watermelon", "kiwi", "mango", "peach", "pineapple"}
	// sort.Ints(intList)
	// sort.Float64s(float8List)
	// sort.Strings(stringList)

	// fmt.Println(intList)
	// fmt.Println(float8List)
	// fmt.Println(stringList)

	// 2、sort降序排序
	sort.Sort(sort.Reverse(sort.IntSlice(intList)))
	sort.Sort(sort.Reverse(sort.Float64Slice(float8List)))
	sort.Sort(sort.Reverse(sort.StringSlice(stringList)))

	fmt.Println(intList)
	fmt.Println(float8List)
	fmt.Println(stringList)
}
